package com.briup.recognition.service.impl;

import com.briup.recognition.bean.BasePrivilege;
import com.briup.recognition.bean.BasePrivilegeExample;
import com.briup.recognition.bean.Greenhouse;
import com.briup.recognition.bean.GreenhouseExample;
import com.briup.recognition.dao.BasePrivilegeMapper;
import com.briup.recognition.dao.GreenhouseMapper;
import com.briup.recognition.service.IBasePrivilegeService;
import com.briup.recognition.service.IGreenhouseService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: recognition
 * @description:
 * @author: charles
 * @create: 2021-03-28 15:11
 **/

@Service
public class BasePrivilegeServiceImpl implements IBasePrivilegeService {

    @Resource
    private BasePrivilegeMapper basePrivilegeMapper;

    @Override
    public List<BasePrivilege> query() {
        BasePrivilegeExample example = new BasePrivilegeExample();
        // 条件

        return basePrivilegeMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdate(BasePrivilege basePrivilege) {
        if(basePrivilege.getId()!=null){
            basePrivilegeMapper.updateByPrimaryKey(basePrivilege);
        } else {
            basePrivilegeMapper.insert(basePrivilege);
        }
    }

    @Override
    public void deleteById(long id) {
        basePrivilegeMapper.deleteByPrimaryKey(id);
    }
}
